﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;


namespace Personal_Cloud_Disk_PC_Client
{
    class EventLog
    {
        private string logFilePathName;


        public EventLog(string logFilePathName)
        {
            this.logFilePathName = logFilePathName;
        }

        public void write(string log, string type = "Info")
        {
            FileStream fileStream = new FileStream(logFilePathName, FileMode.Append);
            StreamWriter streamWriter = new StreamWriter(fileStream);
            string logText = DateTime.Now.ToString() + " (" + type + ") " + log;
            streamWriter.WriteLine(logText);
            streamWriter.Flush();
            streamWriter.Close();
            fileStream.Close();
        }

    }
}
